# Replication Script for 
# "Coordinating Nominations: How to Deal with 
# an Incumbent Surplus after Electoral Reform"
# published in Japanese Journal of Political Science
# author: Jochen Rehmert

# Script replicates:
# Table: 7

# directory
setwd("...")

# packages 
library(foreign);library(stargazer)

# data 
dat <- read.dta("coordination4.dta")

dat$new_cand <- 0
dat$new_cand[dat$candidate_type == "new"] <- 1

dat$exp_soc_voteshare <- dat$exp_votes_socialist/dat$exp_eligibles
dat$exp_ldp_voteshare <- dat$exp_votes_ldp/dat$exp_eligibles

# models
summary(mod.1 <- glm(new_cand ~  inc_smd_ratio + popdensity  , data = dat))
summary(mod.2 <- glm(new_cand ~  inc_smd_ratio + popdensity  + exp_ldp_voteshare, data = dat))

#######################################
# Table 7: Nominating a New Candidate #
#######################################
stargazer(list(mod.1, mod.2),
          covariate.labels = c("Incumbent/SMD Ratio",
                               "Population Density",
                               "Exp. LDP Voteshare"))
